/*
 * Copyright 2013-2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.yiwyn.layuiadmindemo.demos.web;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;


@RestController
@RequestMapping("/data")
public class BasicController {


    @GetMapping("/items")
    public Result getTimelineItems() {
        List<TimelineItem> items = new ArrayList<>();

        for (int i = 0; i < 5; i++) {
            int finalI = i;
            items.add(new TimelineItem() {{
                setTitle("测试" + finalI);
                setContent("今天值班" + finalI);
            }});
        }

        return new Result(0, "success", items);
    }


    @Data
    public static class TimelineItem {
        private Long id;
        private String title;
        private String content;
        private String time;
        private String icon; // 可选的图标类名
        private String color; // 可选的背景颜色
    }

    @Data
    @AllArgsConstructor
    public static class Result {
        private int code;
        private String msg;
        private Object data;
    }


}
